package homework.jdbc.dao;


import java.sql.*;

/**
 * Created by Administrator on 2017/9/13.
 */
public class JDBCUtils {
    private static Connection conn=null;

    public static  Connection getGetConnection(){
      try{
          Class.forName("com.jdbc.mysql.Driver");
          Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3307/test","root","123456");
          return conn;
      } catch (ClassNotFoundException e) {
          e.printStackTrace();
      } catch (SQLException e) {
          e.printStackTrace();
      }
      return null;
  }
  //提供一个关闭连接的方法
    public static void close(){
      try {
          conn.close();
      }catch (SQLException e){
          e.printStackTrace();
      }
    }


}
